<?php

namespace App\Http\Controllers\web;

use App\Http\Controllers\Controller;
use App\Repository\RepositoryInterface\CommissionInterface;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redis;

//佣金类
class CommissionController extends Controller
{
    //
    protected $commission;

    public function __construct(CommissionInterface $commission){
        $this->commission = $commission;
    }

    /**
     * @return mixed
     * 查询该商品团购 的流水
     * 倒序排列
     */
    public function comWithHeadWithOrder(){
        $commissionData = $this->commission->comWithHeadWithOrder();
        return $commissionData;
    }

    /**
     * @param Request $request
     * @return mixed
     * 佣金状态、时间、订单状态、所属团长、订单号进行筛选
     */
    public function comSearch(Request $request){
        $searchInfo = $request->input();
        $searchData = $this->commission->comSearch($searchInfo);
        return $searchData;
    }

    /**
     * @return mixed
     * 判断订单状态， 根据团购商品的价钱计算流水
     */
    public function comOrderStatus(){
        $comOrderStatus = $this->commission->comOrderStatusPrice();
        return $comOrderStatus;
    }

    /**
     * @return mixed
     * 导出团长的流水excel
     */
    public function commissionExcel(){
        $excelEnt = $this->commission->commissionExcel();
        return $excelEnt;
    }
}
